<template>
  <div class="common-body-wrapper">
    <div class="header">
      <router-link
        :to="{
					name: 'addParkingLot'
				}"
        target="_blank"
        class="add-icon"
        v-if="isPermmited('PARK:CONFIG:MANAGE:PARK:ADD')"
      >
        <i class="el-icon-circle-plus"></i> 添加停车场
      </router-link>
      <el-input
        placeholder="模糊搜索停车场"
        v-model="searchVal"
        size="small"
        style="width: 230px"
        @keyup.enter.native="search"
      >
        <!-- <template slot="prepend">停车场</template> -->
        <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
      </el-input>
      <el-button type="text" class="header-right-btn" @click="linkToNewInterComeSettingPage">语音对讲配置</el-button>
    </div>
    <div class="main-content" id="list-box">
      <div
        class="parkinglot-item"
        @mouseenter="item.isShow = true"
        @mouseleave="item.isShow = false"
        v-for="(item, index) in parkConfigInfoList"
      >
        <div class="front-content" v-show="!item.isShow">
          <!--审核状态为新建，审核中，审核失败-->
          <div v-if="item.status != 1">
            <div class="parkinglot-name">
              <div class="name">{{ item.parkName }}</div>
            </div>

            <!--审核中-->
            <div class="parkinglot-item-bd" v-if="item.status == 0">
              <i class="el-icon-loading"></i>
              <div class="approval-status">{{ item.remark }}</div>
            </div>

            <!--审核失败-->
            <div class="parkinglot-item-bd" v-if="item.status == 2">
              <i class="el-icon-warning"></i>
              <div class="approval-status">{{ item.remark }}</div>
            </div>
          </div>

          <!--审核状态为审核成功-->
          <div class="default-item-content" v-if="item.status == 1">
            <div class="parkinglot-name">
              <div class="name">{{ item.parkName }}</div>
              <div class="status" v-if="item.online">上线</div>
            </div>
            <div class="parkinglot-item-bd" v-if="item.property">
              <div class="default-list">
                <div class="list-item" v-if="item.property.parkCode">
                  <i class="el-icon-check"></i>
                  停车场编号：{{ item.property.parkCode }}
                </div>
                <div class="list-item" v-if="item.property.slotsNumber">
                  <i class="el-icon-check"></i>
                  总车位数：{{ item.property.slotsNumber }}
                </div>
              </div>
            </div>
          </div>
        </div>

        <div class="hover-item-content" v-show="item.isShow">
          <div class="parkinglot-name">
            <div class="name">{{ item.parkName }}</div>
            <div class="actions">
              <a
                href="javascript:;"
                @click="stopService(item.parkId)"
                v-if="isPermmited('PARK:CONFIG:MANAGE:PARK:UNDER')"
              >申请下架</a>
              <router-link
                :to="{
									path: '/allParkinglotInfo',
									query: {
										currentTab: '车场信息',
										parkType: item.parkType,
										parkId: item.parkId,
										parkName: item.parkName,
										id: item.id,
                    centralMonitor: item.centralMonitor
									}
								}"
                target="_blank"
                v-if="isPermmited('PARK:CONFIG:MANAGE:PARK_BASE')"
              >车场信息</router-link>
            </div>
          </div>
          <div class="parkinglot-item-bd">
            <div class="hover-item-bd">
              <router-link
                class="item-router-link"
                :to="{
									path: '/allParkinglotInfo',
									query: {
										currentTab: '收费规则',
										parkType: item.parkType,
										parkId: item.parkId,
										parkName: item.parkName,
										id: item.id,
                    centralMonitor: item.centralMonitor
									}
								}"
                target="_blank"
                v-if="item.parkType == 1 && isPermmited('PARK:CONFIG:MANAGE:CHARGE_RULE')"
              >收费规则</router-link>
              <router-link
                class="item-router-link"
                :to="{
									path: '/allParkinglotInfo',
									query: {
										currentTab: '通道配置',
										parkType: item.parkType,
										parkId: item.parkId,
										parkName: item.parkName,
										id: item.id,
                    centralMonitor: item.centralMonitor
									}
								}"
                target="_blank"
                v-if="item.parkType == 1 && isPermmited('PARK:CONFIG:MANAGE:CHANNEL')"
              >通道配置</router-link>
              <router-link
                class="item-router-link"
                :to="{
									path: '/allParkinglotInfo',
									query: {
										currentTab: '设备管理',
										parkType: item.parkType,
										parkId: item.parkId,
										parkName: item.parkName,
										id: item.id,
                    centralMonitor: item.centralMonitor
									}
								}"
                target="_blank"
                v-if="isPermmited('PARK:CONFIG:MANAGE:DEVICE') && !(item.centralMonitor === false && item.parkType === 0)"
              >设备管理</router-link>
              <router-link
                class="item-router-link"
                :to="{
									path: '/allParkinglotInfo',
									query: {
										currentTab: '车场配置',
										parkType: item.parkType,
										parkId: item.parkId,
										parkName: item.parkName,
										id: item.id,
                    centralMonitor: item.centralMonitor
									}
								}"
                target="_blank"
                v-if="isPermmited('PARK:CONFIG:MANAGE:CONFIG')"
              >车场配置</router-link>
              <router-link
                class="item-router-link"
                :to="{
									path: '/allParkinglotInfo',
									query: {
										currentTab: '告警配置',
										parkType: item.parkType,
										parkId: item.parkId,
										parkName: item.parkName,
										id: item.id,
                    centralMonitor: item.centralMonitor
									}
								}"
                target="_blank"
                v-if="isPermmited('PARK:CONFIG:MANAGE:ALARM')"
              >告警配置</router-link>
              <router-link
                class="item-router-link"
                :to="{
									path: '/allParkinglotInfo',
									query: {
										currentTab: '区域配置',
										parkType: item.parkType,
										parkId: item.parkId,
										parkName: item.parkName,
										id: item.id,
                    centralMonitor: item.centralMonitor
									}
								}"
                target="_blank"
                v-if="item.parkType == 1 && isPermmited('PARK:CONFIG:MANAGE:AREA')"
              >区域配置</router-link>
              <a
                href="javascript:;"
                class="item-router-link"
                v-if="item.parkType == 0"
                @click="getVemsUrl(item.property.parkCode)"
              >连接车场</a>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="pagination" v-if="curPageData">
      <el-pagination
        background
        :current-page.sync="pageOpt.pageNumber"
        layout="prev, pager, next, jumper"
        :total="curPageData.totalRow"
        @current-change="handleCurrentChange"
        :page-size="pageOpt.pageSize"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
import pageScript from "./index.js";
export default pageScript;
</script>

<style lang="less" scoped>
@import "./index.less";
</style>
